<template>
  <el-dialog :visible.sync="visible" v-dialogDrag :title="title" :close-on-click-modal="false" class="tl-dialog" width="1200px" @open="open" @close="close">
    <el-form class="tl-form" ref="form" :model="model" :rules="rules" label-width="150px" :disabled="disableEditSubmit">
      <el-row>
        <el-col :span="12">
          <el-form-item label="发送人工号" prop="sendercode" >
            <el-input v-model="model.sendercode" :disabled="true"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="发送人姓名" prop="sendername" >
            <tl-ref-user v-model="model.sendercode" :initDisplayData.sync="model.sendername" @confirm="userConfirm" :externalQueryParam="{ qry_whereSql: ' enabled = 1 and  extendfield1 is not null ' }" dataType="code" :singleSelect="true" :disabled="disableEditSubmit || disableSave"></tl-ref-user>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="接收人工号" prop="receivercode" >
            <el-input v-model="model.receivercode" :disabled="true"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="接收人姓名" prop="receivername" >
            <tl-ref-user v-model="model.receivercode" :initDisplayData.sync="model.receivername" @confirm="userConfirm" :externalQueryParam="{ qry_whereSql: ' enabled = 1 and  extendfield1 is not null ' }" dataType="code" :singleSelect="true" :disabled="disableEditSubmit || disableSave"></tl-ref-user>
          </el-form-item>
        </el-col>
      </el-row>
			<el-row>
				<el-col :span="12">
					<el-form-item label="来源ID" prop="sourceid" >
            <el-input v-model="model.sourceid" type="number" clearable></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="来源类型" prop="sourcetype" >
						<el-input v-model="model.sourcetype" clearable></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="24">
					<el-form-item label="主题" prop="subject" >
						<el-input v-model="model.subject" type="textarea" :rows="4"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="24">
					<el-form-item label="消息内容" prop="content" >
						<el-input v-model="model.content" type="textarea" :rows="4" ></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="12">
					<el-form-item label="状态" prop="state" >
						<el-select v-model="model.state" filterable clearable>
							<el-option v-for="item in codeModel.stateList" :key="item.code" :label="item.name" :value="parseInt(item.code)" />
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="阅读时间" prop="readdate" >
						<el-date-picker v-model="model.readdate" type="date" placeholder="阅读时间" value-format="yyyy-MM-dd"></el-date-picker>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="12">
					<el-form-item label="是否htm" prop="ishtm" >
            <el-select v-model="model.ishtm" filterable clearable>
              <el-option v-for="item in ishtmList" :key="item.code" :label="item.name" :value="item.code"></el-option>
            </el-select>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="24">
					<el-form-item label="消息参数" prop="paramvalue" >
						<el-input v-model="model.paramvalue" type="textarea" :rows="4"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="12">
					<el-form-item label="是否需要跳转" prop="appjump" >
						<el-select v-model="model.appjump" filterable clearable>
							<el-option v-for="item in codeModel.appjumpList" :key="item.code" :label="item.name" :value="item.code" />
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="消息类型" prop="messagetype" >
						<el-select v-model="model.messagetype" filterable clearable>
							<el-option v-for="item in codeModel.messagetypeList" :key="item.code" :label="item.name" :value="item.code" />
						</el-select>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="24">
					<el-form-item label="扩展参数" prop="messageparam" >
						<el-input v-model="model.messageparam" type="textarea" :rows="4"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="24">
					<el-form-item label="备注" prop="description" >
						<el-input v-model="model.description" type="textarea" :rows="4"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="12">
					<el-form-item label="排序码" prop="sortcode">
						<el-input v-model="model.sortcode" type="number" clearable></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="有效" prop="enabled">
						<el-radio-group v-model="model.enabled">
							<el-radio :label="parseInt(item.code)" v-for="item in codeModel.enabledList" :key="item.code">{{ item.name }}</el-radio>
						</el-radio-group>
					</el-form-item>
				</el-col>
			</el-row>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button :type="disableEditSubmit === false ? 'text' : 'primary'" @click="doCancelEdit">取消</el-button>
      <el-button type="primary" @click="doSubmitEdit" :loading="saveLoading" v-if="disableEditSubmit === false">确认</el-button>
    </div>
  </el-dialog>
</template>

<script>
/** mixins */
import { mixin_edit } from '@tapui/mixins/mixin_edit'
/** 子组件 */
/** 工具类 */
import { putAction, getAction, postAction, deleteAction } from '@tapui/utils/http'
/** VUE配置 */
export default {
  mixins: [mixin_edit],
  components: { },
  data() {
    return {
      moduleTitle: 'APP系统消息',
      urlPrefix: '/appv2/appMessageSys/',
      url: {
        // 额外的url
      },
      ishtmList: [{
        code: 1,
        name: '是'
      }, {
        code: 0,
        name: '否'
      }]
    }
  },
  methods: {
    loaded() {
      // 页面加载完毕执行
    }
  }
}
</script>

